package vip.liux.backend.adapter.task;

import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vip.liux.backend.application.service.point.PointsDetailService;

@Profile("scheduled")
@Component
public class ScheduledTask {

    private final PointsDetailService pointsDetailService;

    public ScheduledTask(PointsDetailService pointsDetailService) {
        this.pointsDetailService = pointsDetailService;
    }

    /**
     * 定时扫描并处理过期积分
     */
    @Scheduled(fixedDelay = 180000) // 每3分钟执行一次
    public void scanExpiredPoints() {
        pointsDetailService.scanExpiredPoints();
    }
}
